package com.spring.Repository;

import com.spring.Entity.UserEntity;
import org.springframework.context.annotation.Bean;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

/**
 * Created by Arabira on 2016/8/3.
 */
@Repository
public interface UserRepository extends JpaRepository<UserEntity, String> {
    @Query("from UserEntity u where u.userName = ?1")
    UserEntity findOneByUserName(String userName);

    @Query("from UserEntity u where u.status='1' order by u.userName")
    UserEntity[] findUsersAll();

    @Query("from UserEntity u where u.status='1' and u.userName like ? and u.name like ? and u.department like ? order by u.userName")
    UserEntity[] findReqUsersAll(String userName, String name, String department);
}
